<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp"%> 
<%
	String a1TemplateTableId = request.getParameter("a1TemplateTableId");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>客户查询</title>    
<link href="../css/main.css" rel="stylesheet" type="text/css" >

<link rel="stylesheet" type="text/css" href="../../js/jquery/easyui1.5/themes/bootstrap/easyui.css">
<link rel="stylesheet" type="text/css" href="../../js/jquery/easyui1.5/themes/icon.css">
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<script src="../../js/jquery/easyui1.5/jquery.easyui.min.js"></script>
<script src="../../js/jquery/easyui1.5/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="../../js/jquery.select.js"></script>
<script type="text/javascript">

var datagrid={
    datagridId:"list",
    datagridUrl:"templateAjax_tableRightMenuListBySearch.action",
    datagridObj:{
        /*title:"查询列表",*/
        nowrap:true,
        autoRowHeight:false,
        fit:true,
        columns:[
            [
                {field:'itemName',title:'菜单项名'},
                {field:'url',title:'URL'}
            ]
        ],
        rownumbers:true,
		frozenColumns:[[
					]],
        toolbar:[
                   {
                     id:'addBtnId',
                     text:'添加',
                     iconCls:'icon-add',
                     handler:function(){
                    	 addColumn();
                     }
                   },
                   {
                       id:'refreshBtnId',
                       text:'刷新',
                       iconCls:'icon-reload',
                       handler:function(){
                    	   reLoadData();
                       }
                  }
                 ]
    },
    datagridProperty:{
    	recordDateStart:'创建日期(起)',
    	recordDateEnd:'创建日期(止)'
    },
    datagridPropertySort:{
        id:'默认属性'
    },
    datagridPropertyMultiQuery:{}
};



//添加
function addColumn() { 
	$('#mydialogAdd').show(); 
	$('#mydialogAdd').dialog({
		modal:true, 
		buttons: [{ 
			text: '提交', 
			iconCls: 'icon-ok', 
			handler: function() { 
				$.ajax({
					type:"POST",
					url:"templateAjax_addA1TemplateRightMenu.action",
					dataType:"json",
					data:{
						'a1TemplateTableId':$('#a1TemplateTableId').val(),
						'itemName':$('#itemName').val(),
						'url':$('#url').val()
					},
					success:function(msg){
						var msg = eval("("+msg+")"); 
						if(msg.responseCode==0){
							alert(msg.responseContent);
							return;
						}			
						if(confirm('操作成功\r\n是否刷新数据?')){
							reLoadData(); 
							$('#itemName').val('');
							$('#url').val('');
							$('#mydialogAdd').dialog("close");
						}	
						return;
					},
					error:function(er){
						//alert('操作失败：请先确认是否授权访问该资源');
            			window.parent.error(er);
					}
				 });
			} 
		}, { 
			text: '取消', 
			iconCls: 'icon-cancel', 
			handler: function() { 
				$('#mydialogAdd').dialog("close");
			} 
		}] 
	}); 

} 

</script>
<style type="text/css">
	.west{
		width: 200px;
		padding: 3px;
		style="overflow-y:auto; 
		overflow-x:hidden;"
	}
	.center{
		padding: 3px;
	}
</style>
</head>

    
<body id="wrap" class="easyui-layout" style="margin: 2px;">
	<input type="hidden" id="a1TemplateTableId" name="a1TemplateTableId" value="<%=a1TemplateTableId%>"/>
	
	<div title="条件搜索" style="display: none;">
        <jsp:include page="../condition.jsp"></jsp:include>
		<script type="text/javascript">
			paramData['a1TemplateTableId']=$('#a1TemplateTableId').val();
			reLoadData();  
		</script>
	</div>
	<div region="center" class="center" >
         <table id="list" width="100%" ></table>
	</div>
	
	<!-- 添加对话框 -->
	<div id="mydialogAdd" style="display:none;padding:5px;width:500px; height: 300px" title="添加"> 
		<table class="table3" cellpadding="0" cellspacing="0" align="center" width="100%">
			<tr>
				<td>
					<span>菜单项名:</span>
					<div>
						<input id="itemName" name="itemName" size="30" maxlength="20" class="easyui-validatebox" data-options="required:true"/>
					</div>
				</td>
			</tr>
			<tr>
				<td>
					<span>URL:</span>
					<div>
						<input id="url" name="url" size="30" maxlength="20" class="easyui-validatebox" data-options="required:true"/>
					</div>
				</td>
			</tr>
		</table>
	</div>
	
	
</body>
</html>